<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

  <style>
    * {
      margin: 0;
      padding: 0;
    }

    img {
      width: 520px;
      height: 280px;
    }

    ul,
    li {
      list-style: none;
    }

    ul {
      width: 640px;
      height: 280px;
      margin: 30px auto;
      border: 10px solid pink;
      overflow: hidden;
    }

    li {
      width: 160px;
      height: 100%;
      overflow: hidden;
      position: relative;
      float: left;
    }
  </style>
</head>

<body>
  <ul>
    <li><img src="01.jpg" alt=""></li>
    <li><img src="02.jpg" alt=""></li>
    <li><img src="03.jpg" alt=""></li>
    <li><img src="04.jpg" alt=""></li>
  </ul>
</body>

</html>
<script src='https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js'></script>
<script>

  //初始状态所有的li宽度都是160

  //移入的时候,当前的Li宽度变成520 其它的Li宽度变成40


  $('ul').on('mouseenter', 'li', function () {
    $(this).siblings().stop().animate({ width: 40 }).end().stop().animate({ width: 520 })
  })

  $('ul').on('mouseleave', function () {
    $('li').stop().animate({ width: 160 })
  })



</script>